package com.dang.alex.util;

import java.util.UUID;

public class EmailCode {
	
	public static String CreateEmailCode(){
		UUID uuid=UUID.randomUUID();
		return uuid.toString();
	}
	

	public static String getUid(String code) {
		if(code==null){
		return null;
		}
		int index=code.lastIndexOf("-");
		if(index==-1){
			return null;
		}
		return code.substring(index+1);
	}

	public static String getUUID(String code) {
		if(code==null){
			return null;
		}
		int index=code.lastIndexOf("-");
		if(index==-1){
			return null;
		}
		return code.substring(0,index);
	}

}
